<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>searchBook</title>
</head>
<body>
    <h2>查询图书</h2>
    <form>
        <label>
            请输入要查询的图书ISBN码:
            <input type="text" id="isbn"/><br>
            或书名：
            <input type="text" id="title"/><br>
        </label>
        <button onclick="search()">查询</button>
    </form>
    <script>
        function search() {
            var isbn = document.getElementById("isbn").value;
            var bookName = document.getElementById("title").value;
            let xhr = new XMLHttpRequest();
            xhr.open("get","https://localhost:8080/BookManagement/searchBook?title="+bookName+"&query="+isbn);
            xhr.onreadystatechange = function (){
                if(xhr.readyState === 4 && xhr.status >= 200 && xhr.status < 300){
                    //服务器端已经返回数据了
                    console.log(xhr.responseText);
                } else{
                    console.log(xhr.status);
                }
            }
            xhr.send();
        }
    </script>
</body>
</html>